﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hi_Baidu.ProcessModel;

namespace Hi_Baidu.Timer
{
    /// <summary>
    ///     提供了获取指定好友信息操作的计时操作和后续处理
    /// </summary>
    class GetFriendInfoTimeOutEvent : TimeOutEvent
    {
        private byte[] FriendId;
        private byte[] username;
        public GetFriendInfoTimeOutEvent(byte[] username, byte[] FriendId, String Key, int Interval, int TryCount)
            : base(Key, Interval, TryCount)
        {
            this.username = username;
            this.FriendId = FriendId;
            this.OnTryFull += new EventHandler<EventArgs>(GetFriendInfoTimeOutEvent_OnTryFull);
            this.OnTick += new EventHandler<EventArgs>(GetFriendInfoTimeOutEvent_OnTick);
        }

        void GetFriendInfoTimeOutEvent_OnTick(object sender, EventArgs e)
        {
            GetInfomationModel.GetFriendInfo(username, FriendId);
        }

        void GetFriendInfoTimeOutEvent_OnTryFull(object sender, EventArgs e)
        {
            System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new PUBLIC_DELEGATE(Globle.ShowWindow));
        }
    }
}
